﻿using System;
using System.Windows.Forms;

namespace Citi.FinancePlanningAnalysis.WindowsUI.BoExtraction
{
    public partial class EOBusinessObjectsExtraction : Form
    {
        string reportName;
        string startUrl;
        string userLogin;
        string pathToSave;
        bool joinSheets;
        string newSheetName;
        string parameters;
        bool newWindowNoAction;
        string boUrl;

        public EOBusinessObjectsExtraction(string reportName, string startUrl, string userLogin, string pathToSave, bool joinSheets,
            string newSheetName, string parameters, bool newWindowNoAction, string boUrl)
        {
            InitializeComponent();

            this.reportName = reportName;
            this.startUrl = startUrl;
            this.pathToSave = pathToSave;
            this.userLogin = userLogin;
            this.joinSheets = joinSheets;
            this.newSheetName = newSheetName;
            this.parameters = parameters;
            this.newWindowNoAction = newWindowNoAction;
            this.boUrl = boUrl;

            this.FormClosed += EOBusinessObjectsExtraction_FormClosed;
        }

        void EOBusinessObjectsExtraction_FormClosed(object sender, FormClosedEventArgs e)
        {
            Environment.Exit(Environment.ExitCode);
        }

        private void EOBusinessObjectsExtraction_Load(object sender, EventArgs e)
        {
            webControl.Height = Height;
            webControl.Width = Width;

            new Extract(webControl, reportName, startUrl, null, userLogin, pathToSave, parameters, newWindowNoAction, this).StartExtraction(joinSheets, newSheetName, boUrl);
        }
    }
}